/**
 * Created by win10 on 2019/4/30.
 */
var client = require('./../redis_client');
var gameConfig = require("./../config/gameConfig");
let log = require("./../../util/loginfo").getInstand;

var redis_bet_list_key = "game_serverId" + gameConfig.serverId;

//获得重置下注数组
exports.init_bet_list = function init_bet_list() {
    //清除数组
    client.del(redis_bet_list_key);

};

//下注
exports.save_bet = function save_bet(bet_info) {
    Object.prototype.toString = function () {
        return JSON.stringify(this);
    };
    client.rpush(redis_bet_list_key, bet_info);
};



//获取下注记录
exports.get_bet_list = function get_bet_list() {
    client.lrange(redis_bet_list_key, 0., -1, function (err, lists) {
        log.info('get_bet_list: err :lists: ', err, lists);
        var result=[];
        if(!err){
            for(var i in lists){
                result.push(JSON.parse(lists[i]))
            }
            return result
        }

    })
};




